C++ 问题(高手进来看看^_^)

来源:百度知道 编辑:UC知道 时间:2024/05/19 09:30:58
已知Y=SH(1+SHx)/sh2x+sh3x,其中 SH 为双曲正玄函数,输入X,求Y{sh(x)=exp(x)/2-exp(-x)/2}

#include<iostream.h>
#include<math.h>
double e=2.718;
double sh(double x)
{
double y=(pow(e,x)-pow(e,-x))/2;
return y;
}
void main()
{
double x,y;
cout<<"input x\n";
cin>>x;
y=sh((1+sh(x))/sh(2*x))+sh(3*x);
cout<<y;
}
没运行...

#include<iostream.h>
#include<math.h>
double e=2.718;
double sh(double x)
{
double y=(pow(e,x)-pow(e,-1*x))/2; //请注意这里应该写成-1*x
return y;
}
void main()
{
double x,y;
cout<<"input x\n";
cin>>x;
y=sh((1+sh(x))/sh(2*x))+sh(3*x);
cout<<y;
}

这个太深澳了.. 不知道你在说什么..!! 汗